import requests
import json
import time

url = "https://219.135.214.202:9008/v2x/platform/device/cross/road/add"

payload = json.dumps({
  "id": "",
  "crossId": 2210,
  "crossName": "2210",
  "crossType": 0,
  "roadId": ""
})

headers = {
  'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NjEyNzc3NzUsInVzZXJfbmFtZSI6InN1cGVyX2FkbWluIiwianRpIjoiN2ZkODg2YjYtZGEwNy00NGVmLWIyNjUtOGQyMzhlYWUzYWRhIiwiY2xpZW50X2lkIjoiZnJvbnRlbmQiLCJzY29wZSI6WyJhbGwiXX0.a6Ba94BtbvAuo7AwybTpDs0w5CTAHphDyL55O9X5-zo',
  'Content-Type': 'application/json'
}

def add_road(road_id):
    payload = json.dumps({
        "id": "",
        "crossId": road_id,
        "crossName": "{}".format(road_id),
        "crossType": 0,
        "roadId": ""
    })
    response = requests.request("POST", url, headers=headers, data=payload, verify=False)
    print(response.text)


for i in range(2201,2301):
    add_road(i)
    time.sleep(0.5)


